"""Weather data model."""
from datetime import datetime
from pydantic import BaseModel, Field
from typing import Optional


class WeatherData(BaseModel):
    """Weather data model."""
    
    temperature: float = Field(..., description="Temperature in Celsius")
    condition: str = Field(..., description="Weather condition")
    humidity: int = Field(..., ge=0, le=100, description="Humidity percentage")
    wind_speed: float = Field(..., ge=0, description="Wind speed in km/h")
    aqi: Optional[int] = Field(None, ge=0, description="Air Quality Index")
    timestamp: datetime = Field(default_factory=datetime.utcnow)
    
    class Config:
        """Pydantic config."""
        json_schema_extra = {
            "example": {
                "temperature": 22.5,
                "condition": "晴",
                "humidity": 65,
                "wind_speed": 12.5,
                "aqi": 50,
                "timestamp": "2023-10-01T12:00:00"
            }
        }
